package cn.anecansaitin.not_enough_harness.common.capability.harness_attribute;

import cn.anecansaitin.not_enough_harness.common.harness_data.HarnessSpeed;
import net.minecraft.world.entity.animal.HappyGhast;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;

public class DataMapHarnessAttributeHandler implements HarnessAttributeHandler {
    public static final DataMapHarnessAttributeHandler INSTANCE = new DataMapHarnessAttributeHandler();

    @Override
    public float forwardSpeed(ItemStack harness, HappyGhast happyGhast, Player driver) {
        HarnessSpeed data = HarnessSpeed.getComponentOrDataMapAndSet(harness);
        return data.forwardSpeed();
    }

    @Override
    public float backwardSpeed(ItemStack harness, HappyGhast happyGhast, Player driver) {
        HarnessSpeed data = HarnessSpeed.getComponentOrDataMapAndSet(harness);
        return data.backwardSpeed();
    }

    @Override
    public float leftSpeed(ItemStack harness, HappyGhast happyGhast, Player driver) {
        HarnessSpeed data = HarnessSpeed.getComponentOrDataMapAndSet(harness);
        return data.leftSpeed();
    }

    @Override
    public float rightSpeed(ItemStack harness, HappyGhast happyGhast, Player driver) {
        HarnessSpeed data = HarnessSpeed.getComponentOrDataMapAndSet(harness);
        return data.rightSpeed();
    }

    @Override
    public float upSpeed(ItemStack harness, HappyGhast happyGhast, Player driver) {
        HarnessSpeed data = HarnessSpeed.getComponentOrDataMapAndSet(harness);
        return data.upSpeed();
    }

    @Override
    public float downSpeed(ItemStack harness, HappyGhast happyGhast, Player driver) {
        HarnessSpeed data = HarnessSpeed.getComponentOrDataMapAndSet(harness);
        return data.downSpeed();
    }
}
